<!DOCTYPE html >
<html>
<head>
<meta name="Generator" content="TPshop1.2" />
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>登錄-{$tpshop_config['shop_info_store_title']}</title>
<meta http-equiv="keywords" content="{$tpshop_config['shop_info_store_keyword']}" />
<meta name="description" content="{$tpshop_config['shop_info_store_desc']}" />

<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/public.css"/>
<link rel="stylesheet" type="text/css" href="__STATIC__/css/login.css"/>  
<script type="text/javascript" src="__STATIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/js/mobile_common.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer.js" ></script>
<link rel="stylesheet" href="__STATIC__/css/font-awesome.min.css">
<link rel="stylesheet" href="__STATIC__/css/icomoon.css">
</head>
<body>

 
<div class="tab_nav tab_nav_none">
    <div class="header"><a href="javascript:void(0);" onClick="javascript:history.go(-1);" class="header_l"><i class="fa fa-angle-left"></i></a>
      <div class="h-mid">登 錄   </div>
	<a href="{:U('Index/index')}" class="header_r"><i class="fa fa-home"></i></a>
    </div>
</div>

  	<div class="denglu">
        <center><img src="__STATIC__/images/flow/empty_cart.png" width="200" style="margin:20px 0 0;" ></center>
		<form action="" method="post">        	
            <div class="Login">
				<dl>
	            <dt>用戶名：</dt>
			    	<dd><input type="text" name="username" id="username" placeholder="請輸入郵箱/手機號" value="" /></dd>
				</dl>
                <dl style=" margin-top:15px;">
                <dt>密碼：</dt>
					<dd><input type="password" name="password" id="password" placeholder="密碼"/></dd>
	            </dl>
				<div class="field submit-btn">
					<input type="button" class="btn_big1" onClick="checkSubmit()" value="登 錄" />
					<input type="hidden" name="referurl" id="referurl" value="{$referurl}">
				</div>
            <div class="ng-foot">
              <div class="ng-cookie-area" >
                <label class="bf1 login_ffri">
					<input type="checkbox" name="remember" value="1" checked=""> &nbsp;自動登錄 
				</label>
              </div>
              <div class="ng-link-area" >
                <span style=" margin-right:5px; border-right:1px solid #eeeeee">
                  <a href="{:U('User/reg')}" >免費註冊</a>
                </span>
                 <span class="user_line"></span>
                   <span>
                  <a href="{:U('User/forget_pwd')}" >忘記密碼？</a>
                </span>
              </div>
              <div class="third-area " style="display:none;">
                <div class="third-area-a">第三方登錄</div>
                <a class="ta-qq" href="{:U('LoginApi/login',array('oauth'=>'qq'))}" target="_blank" title="QQ"></a>
                <a class="ta-alipay" href="{:U('LoginApi/login',array('oauth'=>'alipay'))}" target="_blank" title="alipay"></a>
              </div>
            </div>			
          </div>
		</form>
	</div>
<include file="Public/footer_nav"/>
<script type="text/javascript">

function checkSubmit()
{
	
	var username = $.trim($('#username').val());
	var password = $.trim($('#password').val());
	var referurl = $('#referurl').val();
	if(username == ''){
		showErrorMsg('用戶名不能為空!');
		return false;
	}
	if(!checkMobile(username) && !checkEmail(username)){
		showErrorMsg('賬號格式不匹配!');
		return false;
	}
	if(password == ''){
		showErrorMsg('密碼不能為空!');
		return false;
	}
	
	if($.trim($('#verify_code').val()) == ''){
		//showErrorMsg('驗證碼不能為空!');
		//return false;
	}	
	//$('#login-form').submit();
	$.ajax({
		type : 'post',
		url : '/index.php?m=Mobile&c=User&a=do_login&t='+Math.random(),
		data : {username:username,password:password,referurl:referurl},		
		dataType : 'json',
		success : function(res){
			if(res.status == 1){
				top.location.href = res.url;
			}else{
				showErrorMsg(res.msg);
			}
		},
		error : function(XMLHttpRequest, textStatus, errorThrown) {
			showErrorMsg('網絡失敗，請刷新頁面後重試');
		}
	})
}


    function checkMobile(tel) {
        var reg = /(^1[3|4|5|7|8][0-9]{9}$)/;
        if (reg.test(tel)) {
            return true;
        }else{
            return false;
        };
    }
    
    function checkEmail(str){
        var reg = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
        if(reg.test(str)){
            return true;
        }else{
            return false;
        }
    }
    
    function showErrorMsg(msg){
    	//$('.msg-err').show();
    	//$('.J-errorMsg').html(msg);
    	layer.open({content:msg,time:2});
    }
    
    function verify(){
        $('#verify_code_img').attr('src','/index.php?m=Home&c=User&a=verify&r='+Math.random());
     }

</script>	
</body>
</html>